home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Technical Documentation / PCI Information / New Device Driver Model next >
Encoding:
Text File  |  1994-07-21  |  4.8 KB  |  79 lines  |  [TEXT/ttxt]

  1.  
  2. For the first PCI systems, the "new driver model" will only be required for PCI hardware
  3.  interface drivers. Existing 68000 drivers will work without change. As we discussed at WWDC, the new model will be used for all device drivers when the fully-native operating system is available. The new device-driver model is currently for hardware-interface drivers only and it is not clear at this time how virtual drivers (such as an AppleTalk ATP driver that calls an EtherNet driver) will fit into this model.
  4.  
  5. To write drivers that can be easily transported to the new model, you need to do a few things.
  6.  This is a summary, and we will make more information available when the design stabalizes:
  7.  
  8. 1. Write your drivers in very clean C or C++. Except for a framework that interfaces to the Device Manager calls, eliminate all assembler from your driver.
  9.  
  10. 2. Do not call the Toolbox Managers: very few will be supported for drivers. You should be able to call the following:
  11.  
  12. -- Deferred Task Manager: do as much as possible using Deferred Tasks. The Deferred Task Manager will be replaced by a secondary-interrupt service.
  13.  
  14. -- Device Manager:
  15.   -- Write a framework that extracts relevant information from the
  16.      Device Manager call (asynchronous, immediate, read vs. write)
  17.      and calls a separate function to handle the request.
  18.   -- Don't access or modify the DCE.
  19.   -- Don't fake calls to IODone. Immediate calls must return their
  20.      result in their return to the Device Manager. non-immediate
  21.      calls must call IODone with correct final status. Never jump
  22.      to JIODone. Rather call the IODone routine and return to the
  23.      Device Manager. Make sure your driver is fully re-entrant, as
  24.      it may be re-called after calling IODone.
  25.   -- Drivers will receive initialize and terminate calls as their first
  26.      and last calls from the Device Manager. Think about how you will
  27.      support this in your driver, For example, you can call your initalizer
  28.      when OpenDriver is first called, for example.
  29.   -- Open and Close will become connection-oriented. Currently, the first
  30.      Open means "Initialize" and whether "Close" terminates is undefined.
  31.   -- Respond to all Device Manager calls. The "readEnable," "writeEnable,"
  32.      etc. bits in the DCE will be ignored. (Of course, you return an
  33.      error if you don't support a call.)
  34.   -- Don't use the dCtlEMask and dCtlMenu fields. Device Drivers are not
  35.      Desk Accessories.
  36.   -- Concurrent drivers will be supported. If your drivers process multiple
  37.      simultaneous operations, isolate the code that manages the driver queue
  38.      as it will have to be replaced.
  39.   -- In this model, drivers are the interface between the Mac O.S. and some
  40.      piece of hardware. They are at the bottom-end of the food chain and
  41.      should not make PBRead (etc.) calls to other drivers. This may change
  42.      when the new driver model is extended to the fully-native operating
  43.      system.
  44.  
  45. -- Gestalt Manager calls are supported. However, drivers should implement
  46.    the new Driver Gestalt calls.
  47.  
  48. -- Avoid the Memory Manager. Call NewPtrSys and DisposePtr from your
  49.    initialize and terminate routines (i.e, from Open and Close). Don't
  50.    call them elsewhere. A new driver-specific memory management service
  51.    will be provided.
  52.  
  53.    BlockMove (BlockMoveData) is supported.
  54.  
  55. -- Avoid the Notification Manager. I'm not certain at this time whether
  56.    it will be supported for drivers.
  57.  
  58. -- The following O.S. Utilities will be supported:
  59.    -- Debugger, DebugStr
  60.    -- Enqueue, Dequeue
  61.  
  62. -- Resource Manager calls will not be supported, not even in Open and
  63.    Initialize calls. There will be a "System Registry" capability that
  64.    serves the purpose of configuration so, if you must call the Resource
  65.    Manager, do it in an Init, Control Panel or (last choice) in an
  66.    intentionally non-transportable part of your Open routine.
  67.  
  68. -- Stay away from the Segment Loader.
  69.  
  70. -- Time Manager calls will be provided for absolute- and up-time. Time-based
  71.    scheduling (wake-up events triggered by Time Manager completion routines)
  72.    may be supported, but this is not yet clear. Avoid the Vertical Retrace
  73.    Manager traps (I'm not sure how/if they will be supported).
  74.  
  75. 3. Our intent is that PCI drivers written to the new standard will be transportable without change to the fully-native operating system. This is one motivation for the extremely limited access to the Toolbox in this model.
  76.  
  77. Please note that the above is a summary of work-in-progress. The design should stabilize in a month or so and we have every intent of making this information widely available as soon as possible so that driver writers can plan their conversion effort. Right now, the best thing you can do is to write your code in very clean and straight-forward C and isolate initialization, interface, and configuration from your task-specific code.
  78.  
  79.